package com.sneakxy.actions.code;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * @author 潜行的青衣
 * @see
 */
public interface Type {

	public String toString(boolean isNotImport);
	
	public boolean hasImportPackage();
	
	public void setHasPackage(boolean hasPackage);
	
	public String getTypeName();
	
	public String getImportPackage();
	
}


class TypeExt {
	
	private Type type;
	
	TypeExt(Type type) {
		this.type = type;
	}
	@Override
	public int hashCode() {
		return new HashCodeBuilder()
				.append(this.type.getImportPackage())
				.append(this.type.getTypeName()).toHashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if(obj == null) {
			return false;
		}
		if(!(obj instanceof TypeExt)) {
			return false;
		}
		TypeExt type = (TypeExt) obj ;
		return new EqualsBuilder()
				.append(this.type.getImportPackage(), type.type.getImportPackage())
				.append(this.type.getTypeName(), type.type.getTypeName()).isEquals();
	}
	
}